package com.hiwhitley.easy.day10;

/**
 * Created by hiwhitley on 2016/8/14.
 */
public class IsPowerOfTwo {
    public boolean isPowerOfTwo(int n) {
        if (n == 0) return false;

        while (n % 2 == 0) {
            n = n / 2;
        }

        if (n == 1)
            return true;

        return false;

    }
}
